package Card;

import java.util.ArrayList;
import java.util.List;

public class Deck {
    private static final int MAX_NUM = 18;

    private List<Card> cards;

    public Deck() {
        cards = new ArrayList<>();
    }

    public void add(Card.Flush flush, int number) {
        add(new Card(flush, number));
    }

    public void add(Card card) {
        cards.add(card);
    }

    public boolean contain(Card.Flush flush, int number) {
        for (Card c : cards) {
            if (c.getFlush() == flush && c.getNumber() == number)
                return true;
        }

        return false;
    }

    public boolean isFull() {
        return cards.size() == Deck.MAX_NUM;
    }

    public void reset() {
        cards.clear();
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();

        for (Card c : cards) {
            if (sb.length() > 0)
                sb.append(", ");
            sb.append(c);
        }

        return sb.toString();
    }
}
